package com.yingyi.basic.util;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

//封装Json格式的返回结果
//且使用单例模式

@ApiModel(description = "Json格式的返回结果")
@Data
public class JsonResult {
    //private static JsonResult result = new JsonResult();

    @ApiModelProperty(value = "执行结果",required=true)
    private Boolean success = true;

    @ApiModelProperty(value = "错误信息",required=true)
    private String message = "操作成功";

    /**
     * 用于上传成功后返回的数据
     */
    private Object resultObj;

    public JsonResult setMessage(String message) {
        this.success = false;
        this.message = message;
        return this;
    }
    public JsonResult setResultObj(Object obj){
        this.resultObj = obj;
        return this;
    }

    public static JsonResult me(){

        return new JsonResult();
    }



}
